﻿using RabbitMQClient;
using System;
using System.Threading;

namespace RabbitMQWorker1
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            RabbitMQClient.IRabbitMQClient client = new RabbitMQClient.RabbitMQClient(
                host: "localhost",
                port: 5672,
                userName: "root",
                passowrd: "123456"
            );
            client.Receive<Message>("queue_task", m =>
            {
                Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(m));
                Thread.Sleep(2000);
            });
            Console.WriteLine("等待接收数据");
            Console.ReadLine();
        }
    }

    public class Message
    {
        public string a { get; set; }

        public string b { get; set; }
    }
}